/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ua.pp.bizon.cripto.gui;

import ua.pp.bizon.cripto.keystore.CryptoUtil.Direction;

/**
 * 
 * @author roman
 */
public class SelectSourceDialog extends javax.swing.JDialog {


    private static final long serialVersionUID = -4167206454430083932L;
    private Direction direction;

    /**
     * Creates new form SelectSourceDialog
     */
    public SelectSourceDialog(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed"
    // desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        selectFromPathPanel = new ua.pp.bizon.cripto.gui.SelectPathPanel();
        selectToPathPanel = new ua.pp.bizon.cripto.gui.SelectPathPanel();
        encodeButton = new javax.swing.JButton();
        decodeButton = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        encodeButton.setText("Encode");
        encodeButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                encodeButtonActionPerformed(evt);
            }
        });

        decodeButton.setText("Decode");
        decodeButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                decodeButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(
                        layout.createSequentialGroup()
                                .addContainerGap(12, Short.MAX_VALUE)
                                .addGroup(
                                        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addGroup(
                                                        javax.swing.GroupLayout.Alignment.TRAILING,
                                                        layout.createSequentialGroup()
                                                                .addComponent(selectToPathPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                .addContainerGap())
                                                .addGroup(
                                                        javax.swing.GroupLayout.Alignment.TRAILING,
                                                        layout.createSequentialGroup().addComponent(decodeButton)
                                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                                .addComponent(encodeButton).addGap(32, 32, 32))
                                                .addGroup(
                                                        javax.swing.GroupLayout.Alignment.TRAILING,
                                                        layout.createSequentialGroup()
                                                                .addComponent(selectFromPathPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                .addContainerGap()))));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                layout.createSequentialGroup()
                        .addGap(9, 9, 9)
                        .addComponent(selectFromPathPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(selectToPathPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE).addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(encodeButton).addComponent(decodeButton))
                        .addContainerGap(12, Short.MAX_VALUE)));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void decodeButtonActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_decodeButtonActionPerformed
        direction = Direction.DECODE;
        setVisible(false);
    }// GEN-LAST:event_decodeButtonActionPerformed

    private void encodeButtonActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_encodeButtonActionPerformed
        direction = Direction.ENCODE;
        setVisible(false);
    }// GEN-LAST:event_encodeButtonActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton decodeButton;
    private javax.swing.JButton encodeButton;
    private ua.pp.bizon.cripto.gui.SelectPathPanel selectFromPathPanel;
    private ua.pp.bizon.cripto.gui.SelectPathPanel selectToPathPanel;

    // End of variables declaration//GEN-END:variables

    public ua.pp.bizon.cripto.gui.SelectPathPanel getSelectFromPathPanel() {
        return selectFromPathPanel;
    }

    public ua.pp.bizon.cripto.gui.SelectPathPanel getSelectToPathPanel() {
        return selectToPathPanel;
    }
    
    public void setDirection(Direction direction) {
        this.direction = direction;
    }
    
    public Direction getDirection() {
        return direction;
    }
}
